<%--
  Created by IntelliJ IDEA.
  User: root
  Date: 2017/9/3
  Time: 12:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>安全事件列表</title>
    <%@ include file="/WEB-INF/views/common/easyui.jsp"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
    <script src="${ctx}/static/plugins/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
</head>
<body><div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="searchFrom">
            <label>标题：</label>
            <input type="text" id="title" name="title" class="easyui-validatebox" value="" data-options="prompt: '标题'"/>
            <label>时间：</label>
            <input type="text" id="time" name="time" class="easyui-validatebox" value="" data-options="prompt: '时间'"/>
            <label>地点：</label>
            <input type="text" id="location" name="location" class="easyui-validatebox" value="" data-options="prompt: '地点'"/>
            <label>安全事件编号：</label>
            <input type="text" id="code" name="code" class="easyui-validatebox" value="" data-options="prompt: '安全事件编号'"/>
            <br/>
            <%--<label>航空器型号：</label>--%>
            <%--<input type="text" id="modelNum" name="modelNum" class="easyui-validatebox" value="" data-options="prompt: '航空器型号'"/>--%>
            <%--<label>事件经过：</label>--%>
            <%--<input type="text" id="experience" name="experience" class="easyui-validatebox" value="" data-options="prompt: '事件经过'"/>--%>
            <%--<label>人员情况：</label>--%>
            <%--<input type="text" id="aboutPerson" name="aboutPerson" class="easyui-validatebox" value="" data-options="prompt: '人员情况'"/>--%>
            <%--<br/>--%>
            <%--<label>航空器情况：</label>--%>
            <%--<input type="text" id="hangkongqi" name="hangkongqi" class="easyui-validatebox" value="" data-options="prompt: '航空器情况'"/>--%>
            <%--<label>天气情况：</label>--%>
            <%--<input type="text" id="weather" name="weather" class="easyui-validatebox" value="" data-options="prompt: '天气情况'"/>--%>
            <%--<label>现场侦察情况：</label>--%>
            <%--<input type="text" id="xianchang" name="xianchang" class="easyui-validatebox" value="" data-options="prompt: '现场侦察情况'"/>--%>
            <%--<label>其他：</label>--%>
            <%--<input type="text" id="other" name="other" class="easyui-validatebox" value="" data-options="prompt: '其他'"/>--%>
            <%--<label>原因分析：</label>--%>
            <%--<input type="text" id="reason" name="reason" class="easyui-validatebox" value="" data-options="prompt: '原因分析'"/>--%>
            <%--<label>结论：</label>--%>
            <%--<input type="text" id="result" name="result" class="easyui-validatebox" value="" data-options="prompt: '结论'"/>--%>
            <%--<label>专家建议：</label>--%>
            <%--<input type="text" id="expertSuggest" name="expertSuggest" class="easyui-validatebox" value="" data-options="prompt: '专家建议'"/>--%>
            <%--<br/>--%>
            <a href="javascript(0)" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="cx()">查询</a>
            <a href="javascript(0)" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="searchreset()">重置</a>
        </form>
    </div>
</div>
<div id="buttons">
</div>
<table id="dg"></table>
<div id="dlg"></div>
<script type="text/javascript">
    var dg;
    var d;
    $(function(){
        dg=$('#dg').datagrid({
            method: "post",
            url:'${ctx}/hangkong/list',
            fit : true,
            fitColumns : true,
            border : false,
            idField : 'id',
            striped:true,
            pagination:true,
            rownumbers:true,
            pageNumber:1,
            pageSize : 20,
            pageList : [ 10, 20, 30, 40, 50 ],
            singleSelect:true,
            columns:[[
                {field:'id',hidden:true,checkbox:true},
                {field: 'action',title : '操作', formatter : function(value, row, index) {
                    return '<a href="#" onclick="addQueryTab('+row.id+',\'view\')">查看</a>';
                }
                },
                {field:'title',title:'标题',align:'center',sortable:true,width:80},
                {field:'time',title:'时间',align:'center',sortable:true,width:40},
                {field:'location',title:'地点',align:'center',sortable:true,width:40},
                {field:'code',title:'安全事件编号',align:'center',sortable:true,width:40},
                {field:'modelNum',title:'航空器型号',align:'center',sortable:true,width:40},
                {field:'experience',title:'事件经过',align:'right',sortable:true},
                {field:'aboutPerson',title:'人员情况',align:'center',sortable:true,width:40},
                {field:'hangkongqi',title:'航空器情况',sortable:true},
                {field:'weather',title:'天气情况',align:'center',sortable:true,width:40},
                {field:'xianchang',title:'现场侦察情况',align:'center',sortable:true,width:40},
                {field:'other',title:'其他',align:'center',sortable:true},
                {field:'reason',title:'原因分析',align:'center',sortable:true},
                {field:'result',title:'结论',align:'center',sortable:true},
                {field:'expertSuggest',title:'专家建议',align:'center',sortable:true},
            ]],
            headerContextMenu: [
                {
                    text: "冻结该列", disabled: function (e, field) { return dg.datagrid("getColumnFields", true).contains(field); },
                    handler: function (e, field) { dg.datagrid("freezeColumn", field); }
                },
                {
                    text: "取消冻结该列", disabled: function (e, field) { return dg.datagrid("getColumnFields", false).contains(field); },
                    handler: function (e, field) { dg.datagrid("unfreezeColumn", field); }
                }
            ],
            enableHeaderClickMenu: true,
            enableHeaderContextMenu: true,
            enableRowContextMenu: false,
            toolbar:'#tb',
            queryParams:Form.search.serializeObject()
        });

        var pager =$('#dg').datagrid('getPager');
        pager.pagination({
            buttons:$('#buttons')
        });
        initForm();
    });
    function initForm(){
        Win.edit.find("#btn-open-submit").click(function(){
            save();
        });
        Win.edit.find("#btn-open-close").click(function(){
            $.messager.confirm('警告','你确定要关闭窗口吗?',function(r){
                if (r){
                    Win.edit.dialog('close');
                }
            });
        });
    }

    /*点击查看按钮*/
    function addQueryTab(id,type) {
        window.parent.mainpage.mainTabs.addModule('安全事件详情','${ctx}/hangkong/toEdit?id='+id,'');
    }

    /*创建查询对象并查询*/
    function cx(){
        var obj = Form.search.serializeObject();
        dg.datagrid('load',obj);
    }

    function searchreset(){
        Form.search.resetForm();
    }
</script>
<script src="${ctx}/static/plugins/easyui/common/YDataGrid.js?v=11" type="text/javascript"></script></body>
</html>
